# -*-encoding: Utf-8 -*-
# author: 黄景涛
# Time：2025/3/11

class AutoIterator:
    def __init__(self, start, end):
        self.current = start
        self.end = end

    def __iter__(self):
        return self  # 必须返回迭代器实例本身

    def __next__(self):
        if self.current >= self.end:
            raise StopIteration
        value = self.current
        self.current += 1
        return value


if __name__ == '__main__':
    counter = AutoIterator(1, 10)
    print(f"迭代器实例：{counter}")
    for num in counter:
        print(f"迭代输出：num = {num}")
        print(f"next_start: {counter.current}")
        print("=======================")


